package com.mrtaohuan.data.dao;

import static com.mrtaohuan.data.OfyService.ofy;

import com.googlecode.objectify.Key;
import com.mrtaohuan.data.entity.User;

public class UserDAO {

	public long save(User user) {
		final Key<User> key = ofy().save().entity(user).now();
		return key.getId();
	}

	public void delete(User user) {
		ofy().delete().entity(user).now();
	}

	public User get(String email) {
		final Key<User> key = Key.create(User.class, email);
		return ofy().load().key(key).now();
	}

}
